#include <windows.h>
#include "packet.h"
#include "socket.h"
#include "scene_object.h"

// first parameter in ecx
#ifndef __thiscall
#	define __thiscall __attribute__((__thiscall))
#endif//__thiscall

// first parameter in ecx, edx
#ifndef __fastcall
#	define __fastcall __attribute__((__fastcall))
#endif//__fastcall

typedef enum { walk = 0, run = 1 } move_type;

typedef struct {} PatchFinder;
bool __fastcall AutoMoveTo(PatchFinder* finder, move_type type, int x, int y) = 0x00540870;
PatchFinder** path_finder = (PatchFinder**)0x00659208;

void __thiscall GetNextNode(void**) = 0x004FB910;

POINT* hero_pos = (POINT*)0x006615CC;

int main(int argc, const char* argv[])
{
// 	AutoMoveTo(*path_finder, 207, 1445);
// 	while ( hero_pos->x != 207 || hero_pos->y != 1445)
// 		Sleep(100);
// 
// 	AutoMoveTo(*path_finder, 214, 1426);
// 	while ( hero_pos->x != 214 || hero_pos->y != 1426)
// 		Sleep(100);
// 
// 	AutoMoveTo(*path_finder, 225, 1407);
// 	while ( hero_pos->x != 225 || hero_pos->y != 1407)
// 		Sleep(100);
// 
// 	AutoMoveTo(*path_finder, 237, 1393);
// 	while ( hero_pos->x != 237 || hero_pos->y != 1393)
// 		Sleep(100);
// 
// 	AutoMoveTo(*path_finder, 249, 1375);
// 	while ( hero_pos->x != 249 || hero_pos->y != 1375)
// 		Sleep(100);

//	AutoMoveTo(*path_finder, 257, 1371);
//  	for (int i = 0; i < MAX_SOLT_COUNT; ++i)
//  	{
//  		printf("[%d]%d\n", bag_solt[i].item_index, bag_solt[i].item_count);
//  	}
// 	for (int i = 0; i < game_info->scene_object_count; ++i)
// 	{
// 		printf("0x%08X - %s[%d,%d]\n", &game_info->scene_obj[i], game_info->scene_obj[i]->obj_name, game_info->scene_obj[i]->obj_pos.x, game_info->scene_obj[i]->obj_pos.y);
// 	}
//	AutoMoveTo(*path_finder, run, game_info->scene_obj[0]->obj_pos.x, game_info->scene_obj[0]->obj_pos.y);

	use_bag_item(0x0a);

	return 0;
}
void DisplatSceneObject()
{
	int tmp = *(int*)(0x0057E640 + 0x1B0C);
	if (NULL != tmp)
	{
		int node = *(int*)tmp;
		while (node != tmp)
		{
			if (NULL != obj)
			{

			}

			GetNextNode(&node);
		}
	}
}